﻿using System;
using JetBrains.Annotations;
using Missbot.Common;

namespace Missbot.Core.SyntaxChecker.ParamCheckers
{
    [UsedImplicitly]
    public class LongParam : IParam
    {
        public Type CheckType => typeof(long);

        public (bool isValid, object param, string unsolvedMsg) Check(string msg)
        {
            var (param, unsolvedMsg) = msg.SplitParam();
            return !long.TryParse(param, out var data) ? (false, null, null) : (true, data, unsolvedMsg);
        }
    }
}